imx: mx7: run sec_init for CAAM RNG
authorBryan O'Donoghue <[email protected]>
Fri, 26 Jan 2018 16:27:58 +0000 (16:27 +0000)
committerStefano Babic <[email protected]>
Sun, 4 Feb 2018 11:14:11 +0000 (12:14 +0100)
This patch adds a sec_init call into arch_misc_init(). Doing so in
conjunction with the patch "drivers/crypto/fsl: assign job-rings to
non-TrustZone" enables use of the CAAM in Linux when OPTEE/TrustZone is
active.

u-boot will initialise the RNG and assign ownership of the job-ring
registers to a non-TrustZone context. With recent changes by Lukas Auer to
fully initialize the RNG in sec_init() this means that u-boot will hand-off
the CAAM in a state that Linux then can use the CAAM without touching the
reserved DECO registers.

This change is safe both for the OPTEE/TrustZone boot path and the regular
non-OPTEE/TrustZone boot path.

Signed-off-by: Bryan O'Donoghue <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Marco Franchi <[email protected]>
Cc: Vanessa Maegima <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Lukas Auer <[email protected]>
Tested-by: Lukas Auer <[email protected]>
Reviewed-by: Fabio Estevam <[email protected]>
arch/arm/mach-imx/mx7/soc.c

index 172be2ccc00ba97b321aeb21a9bb0b0385d0dde3..d349676b8116b04c5ba7cf6975955889d519f097 100644 (file)
@@ -17,6 +17,7 @@
 #include <asm/arch/crm_regs.h>
 #include <dm.h>
 #include <imx_thermal.h>
+#include <fsl_sec.h>
 
 #if defined(CONFIG_IMX_THERMAL)
 static const struct imx_thermal_plat imx7_thermal_plat = {
@@ -191,6 +192,10 @@ int arch_misc_init(void)
                env_set("soc", "imx7s");
 #endif
 
+#ifdef CONFIG_FSL_CAAM
+       sec_init();
+#endif
+
        return 0;
 }
 #endif